/**
 * 岗位接口
 */

const Router = require("koa-router");
const router = new Router();
const { SystemDeptController } = require("../controller/sys_dept.js");
const auth = require("../middleware/auth.js");
const passport = require("koa-passport");
const dataScope = require("../middleware/dataScope.js");

router.get(
  "/v1/system/dept/all",
  passport.authenticate("jwt", { session: false }),
  auth("system:dept:query"),
  dataScope,
  SystemDeptController.sysAllDeptList
);

router.get(
  "/v1/system/dept/list",
  passport.authenticate("jwt", { session: false }),
  auth("system:dept:query"),
  dataScope,
  SystemDeptController.sysDeptList
);

router.post(
  "/v1/system/dept/add",
  passport.authenticate("jwt", { session: false }),
  auth("system:dept:add"),
  SystemDeptController.sysDeptAdd
);
router.post(
  "/v1/system/dept/delete",
  passport.authenticate("jwt", { session: false }),
  auth("system:dept:remove"),
  SystemDeptController.sysDeptDel
);
router.post(
  "/v1/system/dept/deleteByIds",
  passport.authenticate("jwt", { session: false }),
  auth("system:dept:remove"),
  SystemDeptController.sysDeptDelByIds
);
router.put(
  "/v1/system/dept/update",
  passport.authenticate("jwt", { session: false }),
  auth("system:dept:edit"),
  SystemDeptController.sysDeptUpd
);
router.get(
  "/v1/system/dept/getById",
  passport.authenticate("jwt", { session: false }),
  auth("system:dept:query"),
  SystemDeptController.sysDeptById
);

router.get(
  "/v1/system/dept/exclude",
  passport.authenticate("jwt", { session: false }),
  auth("system:dept:query"),
  SystemDeptController.sysDeptExclude
);

router.post(
  "/v1/system/user/deptTree",
  passport.authenticate("jwt", { session: false }),
  auth("system:dept:query"),
  SystemDeptController.deptTree
);
module.exports = router;
